﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Tanks.Contracts;

namespace TanksGame
{

    /// <summary>
    /// Fuckin 2D Sprite!
    /// </summary>
    class Sprite
    {
        public Texture2D Texture { get; private set; }
        public Rectangle Rectangle ;
        public MapItemType MapItemType { get; private set; }
        public int Width { get; private set; }
        public int Height {get; private set;}
        
        /// <summary>
        /// Constructor of square sprite. Sprite size in pixels = size*18. Sprite coordinates i pixels = coordinate*18
        /// </summary>
        public Sprite (MapItemType mapItemType, Texture2D texture, int x, int y, int size)
        {
            Rectangle = new Rectangle(x*18, y*18, size*18, size*18);
            Texture = texture;
            MapItemType = mapItemType;
        }

        /// <summary>
        /// Constructor of custom Sprite. width, height, x, y - in pixels;
        /// </summary> 
        public Sprite(MapItemType mapItemType, Texture2D texture, int x, int y, int width, int height)
        {
            Rectangle = new Rectangle(x, y, width, height);
            Texture = texture;
            MapItemType = mapItemType;
        }

        public virtual void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(Texture, Rectangle, Color.White);
        }

        public virtual void Update(GameTime gameTime, KeyboardState keyboardState)
        {
            
        }

    }
}
